package com.atguigu.boot2.process;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

import javax.annotation.PreDestroy;

/**
 * @Author yanglin [2533188365@qq.com]
 * @Create 2025-02-19 16:31
 * @Description:
 */
@Component
public class MyBean implements InitializingBean, DisposableBean {
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("Bean的属性已经设置完成");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("Bean马上就要销毁了");
    }

    @PreDestroy
    public void test(){
        System.out.println("Bean 销毁前调用了这个方法");
    }
}
